<?php

    // +----------------------------------------------------------------------
    // | 用户积分记录
    // +----------------------------------------------------------------------
    // | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
    // +----------------------------------------------------------------------
    // | Author: 微尘 <yicmf@qq.com>
    // +----------------------------------------------------------------------

    namespace app\model\ucenter;

    class UserPoint extends Common
    {


        public function user()
        {
            return $this->belongsTo(User::class);
        }

        public function admin()
        {
            return $this->belongsTo(User::class,'admin_id');
        }

		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeInsert($data)
		{
			$data['status'] = 1;
			$data['ip'] = request()->ip();
		}


		protected function setIpAttr()
        {
            return self::$request->ip();
        }

    }
